package javaweb_work01.login.service;

import javaweb_work01.login.Dao.UserDao;
import javaweb_work01.login.Entity.User;
import javaweb_work01.login.Factory.UserDaoFactory;

/**
 * indexServlet与数据之间的Service类
 */
public class UserService {
    //合成复用原则
    private UserDao userDao;

    public UserService(){
        //调用工厂类的静态方法得到对象
        this.userDao = UserDaoFactory.getUserDao();
    }

    /**
     * 自定义成员方法实现根据参数指定的User对象来调用DAO层实现登录功能
     * @param user
     * @return
     */
    public User userLoginService(User user){
        return userDao.userLogin(user);
    }
}
